//服务层
const {getAll3,addOne3,getOne3,updateOne3,deleteOne3} = require('../dao/categoryDao');
module.exports.getAll2 = async function(){
    return await getAll3();
}

module.exports.addOne2 = async (ctg)=>{
    const data = await addOne3(ctg);
    if(data._id){
        return true;
    }else{
        return false;
    }
}

module.exports.getOne2 = async _id => {
	return await getOne3(_id);
};
module.exports.updateOne2 = async cate => {
	const data = await updateOne3(cate);
	if (data.ok == 1) {
		return true;
	}
	return false;
};
module.exports.deleteOne2 = async function(cateId) {
	const data = await deleteOne3(cateId);
	if (data.deletedCount == 1) {
		return true;
	}
	return false;
};